package com.mall.product.service;

import com.mall.common.core.text.Convert;
import com.mall.common.utils.DateUtils;
import com.mall.product.domain.biz.ProBrandRecommendedBiz;
import com.mall.product.domain.entity.ProBrandRecommended;
import com.mall.product.mapper.ProBrandRecommendedMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 品牌推荐Service业务层处理
 *
 * @author zhonglin
 * @date 2020-05-19
 */
@Service
public class ProBrandRecommendedService {

  @Autowired
  private ProBrandRecommendedMapper proBrandRecommendedMapper;

  /**
   * 查询品牌推荐
   *
   * @param brandRecommendedId 品牌推荐ID
   *
   * @return 品牌推荐
   */
  public ProBrandRecommendedBiz selectProBrandRecommendedById(Long brandRecommendedId) {

    return proBrandRecommendedMapper.selectProBrandRecommendedById(brandRecommendedId);
  }

  /**
   * 查询品牌推荐列表
   *
   * @param proBrandRecommended 品牌推荐
   *
   * @return 品牌推荐
   */
  public List<ProBrandRecommendedBiz> selectProBrandRecommendedList(ProBrandRecommended proBrandRecommended) {

    return proBrandRecommendedMapper.selectProBrandRecommendedList(proBrandRecommended);
  }

  /**
   * 新增品牌推荐
   *
   * @param proBrandRecommended 品牌推荐
   *
   * @return 结果
   */
  public int insertProBrandRecommended(ProBrandRecommended proBrandRecommended) {

    proBrandRecommended.setCreateTime(DateUtils.getNowDate());
    return proBrandRecommendedMapper.insertProBrandRecommended(proBrandRecommended);
  }

  /**
   * 修改品牌推荐
   *
   * @param proBrandRecommended 品牌推荐
   *
   * @return 结果
   */
  public int updateProBrandRecommended(ProBrandRecommended proBrandRecommended) {

    proBrandRecommended.setUpdateTime(DateUtils.getNowDate());
    return proBrandRecommendedMapper.updateProBrandRecommended(proBrandRecommended);
  }

  /**
   * 删除品牌推荐对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteProBrandRecommendedByIds(String ids) {

    return proBrandRecommendedMapper.deleteProBrandRecommendedByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除品牌推荐信息
   *
   * @param brandRecommendedId 品牌推荐ID
   *
   * @return 结果
   */
  public int deleteProBrandRecommendedById(Long brandRecommendedId) {

    return proBrandRecommendedMapper.deleteProBrandRecommendedById(brandRecommendedId);
  }

  public List<ProBrandRecommendedBiz> selectRecommendedBrandAll() {
    return proBrandRecommendedMapper.selectRecommendedBrandAll();
  }

}
